/*
 * @Description:
 * @Author: maskMan
 * @LastEditTime: 2024-03-20 19:24:25
 */
import { _decorator, Component, Node, EventHandle, v3, Vec3, EventTouch } from "cc";
import { bordManger } from "./bordManger";
const { ccclass, property } = _decorator;

@ccclass("mainUi")
export class mainUi extends Component {
  @property(bordManger)
  bordManger: bordManger = null;
  ballPos: Vec3 = v3();
  start() {
    this.node.on(Node.EventType.TOUCH_MOVE, (e: EventTouch) => {
      if (this.bordManger.currBall) {
        const currPos = e.getDelta();
        this.bordManger.currBall.node.getPosition(this.ballPos);
        this.ballPos.x += currPos.x * (8 / 720);
        this.bordManger.currBall.node.setPosition(this.ballPos);
      }
    });
  }
  update(deltaTime: number) {}
}
